﻿using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using ProjectAutumn;

namespace Test_Project
{
    internal static class Program
    {
        [STAThread]
        private static void Main()
        {
#if DEBUG
            if (!Debugger.IsAttached)
                AppDomain.CurrentDomain.UnhandledException += (sender, e) => MessageBox.Show(e.ExceptionObject.ToString());
#endif
            Form1 form = null;
            //I create a new thread so it doesn't screw up with creating new forms.
            var thd = new Thread(new ThreadStart(delegate
            {
                form = new Form1();
                Application.EnableVisualStyles();
                Application.Run(form);
            }));
            thd.Start();
            thd.Join();
            if(form.ClickedOK)
                using(Game game = new TestGame())
                    game.Run(form.WantedWindowSystem, form.WantedGraphicsSystem, form.WantedInputSystem);
        }
    }
}